<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'category-form',
	'enableAjaxValidation'=>true,
)); ?>

	<?php echo Yii::t('admin','<p class="note">Fields with <span class="required">*</span> are required.</p>');?>	


	<?php echo $form->errorSummary($model); ?>

	<div class="box">
		<div class="row">
			<?php echo $form->labelEx($model,'cate_name'); ?>
			<?php echo $form->textField($model,'cate_name',array('size'=>50,'maxlength'=>50)); ?>
			<?php echo $form->error($model,'cate_name'); ?>
		</div>	
	</div>

	<div class="box">
		<div class="row">
			<?php echo $form->labelEx($model,'cate_link'); ?>
			<?php echo $form->textField($model,'cate_link',array('size'=>60,'maxlength'=>500)); ?>
			<?php echo $form->error($model,'cate_link'); ?>
		</div>	
	</div>
	
	<div class="box">	
		<?php if(!$model->isNewRecord && $model->cate_pid == 0):?>
			<?php echo $form->hiddenField($model,'cate_pid');?>
		<?php else:?>	
		<div class="row column3">
			<?php echo $form->labelEx($model,'cate_pid'); ?>
			<?php // $dropdownlist = Category::model()->getCategoryDropdownList($model->cate_type);?>
			<?php $dropdownlist = Category::model()->getArticleCategoryDropdownList(); ?>
			<?php echo $form->dropDownList($model,'cate_pid',$dropdownlist,array(
					'options'=>array($model->cate_pid=>array('selected'=>true)),
					'style'=>'height:25px;'											
			)); ?>	
			
			<?php echo $form->error($model,'cate_pid'); ?>
		</div>
		<?php endif;?>
		<div class="row column3">
			<?php echo $form->labelEx($model,'cate_contype'); ?>
			<?php echo $form->dropDownList($model,'cate_contype',Category::model()->generateContentTypeDropdownListArray(),array(
				'options'=>array($model->cate_contype=>array('selected'=>true)),
				'style'=>'height:25px;'
			)); ?>
			<?php echo $form->error($model,'cate_contype'); ?>
		</div>	
		<div class="row column3">
			<?php echo $form->labelEx($model,'cate_recommend'); ?>
			<?php echo $form->dropDownList($model,'cate_recommend',Category::model()->generateCategoryRecommendDropdownListArray(),array(
				'options'=>array($model->cate_recommend=>array('selected'=>true)),
				'style'=>'height:25px;'
			)); ?>
			<?php echo $form->error($model,'cate_recommend'); ?>
		</div>	
	<hr />
		<div class="row">
			<?php echo $form->labelEx($model,'cate_order'); ?>
			<?php echo $form->textField($model,'cate_order'); ?>
			<?php echo $form->error($model,'cate_order'); ?>
		</div>

		<div class="row">
			<?php echo $form->labelEx($model,'cate_des'); ?>
			<?php echo $form->textArea($model,'cate_des',array('rows'=>6, 'cols'=>50)); ?>
			<?php echo $form->error($model,'cate_des'); ?>
		</div>

		<div class="row buttons">
			<?php $this->widget('zii.widgets.jui.CJuiButton',
					array(
						'name'=>'button',
						'buttonType'=>'button',
						'htmlOptions'=>array(
							'id'=>'cate_submit',
							'onclick'=>'categoryUpdate()'
						),
						'caption'=>$model->isNewRecord ? 'Create' : 'Save',
//						'onclick'=>'js:function(){alert("Save button clicked"); this.blur(); return false;}',
//						'onclick'=>'js:function(){categoryUpdate();}'
					)
				);
			?>
		</div>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->